<div class="wrapper">
    <div>
        <div class="box box-top">
            <!-- /.box-header -->
            <!-- form start -->
            <form id="batteryBoxForm" role="form" action="${base}/admin/batteryBox/save" method="post">
                <input type="hidden" name="id" value="${(batteryBox.id)!}">
                <input type="hidden" value="${(batteryBox.batteryCabinetId)!}" class="form-control" name="batteryCabinetId" id="batteryCabinetId">
                <input type="hidden" value="${(batteryBox.status)!}" class="form-control" name="status" id="status">
                <div class="box-body">
                        <div class="form-group">
                            <label for="no">Code</label>
                            <input type="text" value="${(batteryBox.no)!}" class="form-control" name="no" id="no">
                        </div>
                        <div class="form-group">
                            <label for="name">Name</label>
                            <input type="text" value="${(batteryBox.name)!}" class="form-control" name="name" id="name">
                        </div>
                        <div class="form-group">
                            <label for="memo">Note</label>
                            <input type="text" value="${(batteryBox.memo)!}" class="form-control" name="memo" id="memo">
                        </div>
                        <div class="form-group">
                            <label for="valid">Valid</label>
                            <select name="valid" id="valid" class="form-control">
                                <option value="true" <#if (batteryBox.valid)!true> selected="selected"</#if>>----Valid----</option>
                                <option value="false" <#if ((batteryBox.valid)!true)==false> selected="selected"</#if>>----Invalid----</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="batteryNo">电池编号</label>
                            <input type="text" value="${(batteryBox.battery.no)!}" class="form-control" name="batteryNo" id="batteryNo">
                        </div>
                    <div class="box-footer">
                        <button type="button" onclick="$('#batteryBoxForm').submit();" class="btn btn-primary">Save
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function() {
        $("#batteryBoxForm").validate({
            submitHandler:function(form){
                submitBatteryBox();
            }
        });
    });
    function submitBatteryBox(){
        HF.ajaxFormSubmit('batteryBoxForm',function(result){
            alert("Save Success");
            document.location.reload();
        },function(e){ alert("Save Failure");});
    }
</script>
